package com.wntms.yjj.dao;

import com.wntms.yjj.pojo.Customer;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface CustomerManagerDao {

    @Delete("delete from customer_information where id=#{id}")
    public Integer deleteC(Integer id);
    @Delete("delete from user where id=#{uid}")
    public Integer deleteU(Integer uid);

    @Update("update customer_information set name=#{name}, tel=#{tel},customertype=#{customertype} where id=#{id}")
    public Integer updateC(Customer customer);
    @Update("update user set name=#{name} where id=#{uid}")
    public Integer updateU(@Param("uid") Integer uid,@Param("name") String name);


    @Select("select *from customer_information")
    public List<Customer> findAll();

    @Select("select *from customer_information where id=#{id}")
    public Customer findById(Integer id);

    @Select("select *from customer_information where tel=#{tel}")
    public Customer findByTel(String tel);

    @Select("select *from customer_information where name=#{name}")
    public Customer findByName(String name);

    @Select("select *from customer_information where customerType=#{type}")
    public List<Customer> findByType(String type);

}
